package com.lunarshades.samsara.ui.fonts;

import java.awt.Font;
import java.util.ArrayList;
import java.util.List;

public final class Fonts {

private Fonts() {
}

public static Font getPlainFont() {
    return FONTS.get(0);
}

public static Font getBoldFont() {
    return FONTS.get(1);
}

public static Font getNumberFont() {
    return FONTS.get(2);
}

public static Font getDerivePlainFont(Font otherFont) {
    if (otherFont.isTransformed()) {
        return FONTS.get(0).deriveFont(otherFont.getStyle(),
                otherFont.getTransform()
        );
    } else {
        return FONTS.get(0).deriveFont(otherFont.getStyle());
    }
}

public static Font getDeriveBoldFont(Font otherFont) {
    if (otherFont.isTransformed()) {
        return FONTS.get(1).deriveFont(otherFont.getStyle(),
                otherFont.getTransform()
        );
    } else {
        return FONTS.get(1).deriveFont(otherFont.getStyle());
    }
}

public static Font getDerivedNumberFont(Font otherFont) {
    if (otherFont.isTransformed()) {
        return FONTS.get(2).deriveFont(otherFont.getStyle(),
                otherFont.getTransform()
        );
    } else {
        return FONTS.get(2).deriveFont(otherFont.getStyle());
    }
}

private static final List<Font> FONTS;

static {
    FONTS = new ArrayList<Font>();

    Font font;

    font = Font.decode("Candara-PLAIN-13");
    FONTS.add((font != null ? font : Font.decode("Dialog-PLAIN-12")));

    font = Font.decode("Candara-BOLD-13");
    FONTS.add((font != null ? font : Font.decode("Dialog-BOLD-12")));

    font = Font.decode("Corbel-PLAIN-14");
    FONTS.add((font != null ? font : Font.decode("Monospaced-PLAIN-12")));
}
}
